from manim import *
import manimpango
from pprint import pprint

class logo(MovingCameraScene):
    def construct(self):
        self.camera.background_color = WHITE  # 设置相机的背景颜色为白色       
        # pprint(manimpango.list_fonts())
 
        logo_cir_big = Circle(fill_opacity=1, radius=5).set_opacity(1)
        logo_cir_big.set_color( ['#e4e7c7', '#ffa9f9', '#a08a9f'] )
        logo_cir_big.set_sheen_direction(DR)
        
        logo_cir_small = Circle(fill_opacity=1, radius=4.56789).set_opacity(1)
        logo_cir_small.set_color( ['#ffffff', '#fff9e3', '#ffdffe'] )
        logo_cir_small.set_sheen_direction(DR)
        logo_cir_small.shift(LEFT*0.343+DOWN*0.323)

        TARO_letters = [Text(char, font_size=256, font="Anton", color='#d967b5') for char in "TARO"]
        TARO_vgroup = VGroup(*TARO_letters).arrange(buff=0.111, aligned_edge=DOWN).shift(LEFT*2.2222+DOWN*1.8)  # buff=0.1 是字母之间的间距
        print("qwq", TARO_vgroup)

        CAKE_letters = [Text(char, font_size=88.484, font="Montserrat Light", color='#dea5cc') for char in "CAKE"]
        CAKE_vgroup = VGroup(*CAKE_letters).arrange(buff=0.121, aligned_edge=DOWN).next_to(TARO_vgroup, DOWN).shift(LEFT*1.242)

        TEAM_letters = [Text(char, font_size=88.484, font="Montserrat Light", color='#dea5cc') for char in "TEAM"]
        TEAM_vgroup = VGroup(*TEAM_letters).arrange(buff=0.121, aligned_edge=DOWN).next_to(CAKE_vgroup)

        YUNIDANGAO_hanzi = [Text(char, font_size=50, font="Yu Gothic UI Semibold", color='#dea5cc') for char in  ["芋","泥","蛋","糕"]]
        YUNIDANGAO_vgroup = VGroup(*YUNIDANGAO_hanzi).arrange(direction=DOWN,buff=0.111, aligned_edge=LEFT).next_to(TARO_vgroup, RIGHT)

        self.play(
            # self.camera.frame.animate.shift(UP*2.2222).set(width = 25),
            self.camera.frame.animate.set(width = 25),
        )


        self.play(
            SpiralIn(
                VGroup(logo_cir_big, logo_cir_small ),
                run_time = 5
            ),
            AnimationGroup(
                Write(TARO_vgroup),
                Write(YUNIDANGAO_vgroup),
                Write(CAKE_vgroup),
                Write(TEAM_vgroup),
                lag_ratio=0.2,
                run_time=5
            ),
            lag_ratio=0.2
        )

        self.play(
            ApplyMethod(
                logo_cir_big.set_sheen_direction, 
                DL, 
                rate_func=rate_functions.ease_in_out_sine, 
                run_time=2
            )
        )

        self.wait(2)


        # self.play(FadeIn(logo_cir_big))
        # self.play(FadeIn(logo_cir_small))
        # self.play(FadeIn(TARO_vgroup))
        # self.play(FadeIn(CAKE_vgroup))
        # self.play(FadeIn(TEAM_vgroup))
        # self.play(FadeIn(YUNIDANGAO_vgroup))
        # self.wait(2)

        # if isinstance(Text("qwq"), Mobject):
        #     print("qwq yes")
        # else:
        #     print("qwq no")
